﻿@using DirectSell.Model.User
@using Webdiyer.WebControls.Mvc;
@model  PagedList<UserInforMationDetails>
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/User/Views/Shared/UserLayout.cshtml";
}
<!-- APP MAIN ==========-->
    <main id="app-main" class="app-main">
        <div class="wrap">
            <section class="app-content">
                <div class="widget p-lg">
                    <h4 class="m-b-lg">会员激活</h4>
                    <div class="table-responsive">
                        <div class="text-center p-t-sm p-b-sm">
                            <nav class="page-redcolor">
                                <div id="orders">
                                    <div id="dvCategoryResults">
                                        @Html.Partial("List", Model)
                                        </div>
                                        <div style="width:100%;overflow:auto;">
                                      <div style="float:right">Go to page<select id="pib"></select></div>
                                    @Ajax.Pager(Model, new PagerOptions
                                   {
                                       PageIndexParameterName = "page",
                                       ContainerTagName = "ul",
                                       CssClass = "pagination",
                                       PageIndexBoxId = "pib",
                                       Id = "mypager",
                                       CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>",
                                       DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>",
                                       PagerItemTemplate = "<li>{0}</li>"
                                   }).AjaxOptions(a => a.SetUpdateTargetId("orders").EnablePartialLoading())
                                        </div>
                                    </div>
                            </nav>
                           
                            @section scripts{ @{Html.RegisterMvcPagerScriptResource();}}

                          
                        </div>
                    </div>
                </div><!-- .widget -->
            </section><!-- #dash-content -->
        </div><!-- .wrap -->
        <!-- APP FOOTER -->
        <div class="wrap p-t-0">
            <footer class="app-footer">
                <div class="clearfix">
                    <div class="copyright text-center w100">@DirectSell.Common.Url.CommonConfig.companyName &copy;</div>
                </div>
            </footer>
        </div>
        <!-- /#app-footer -->
    </main>
    <script type="text/javascript">
        function Activation(UserId) {
            layer.confirm('确定要激活该会员吗？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                //加载层
                var index = layer.load(1, {
                    shade: [0.1, '#fff']
                });
                $.ajax({
                    type: "post",
                    url: "/User/Activation/Activation",
                    data: { UserId: UserId },
                }).success(function (message) {
                    if (message != '成功') {
                        layer.msg(message, { icon: 2 });
                    }
                    else {
                        $("#dvCategoryResults").load('@(Url.Action("List", "Activation", null, Request.Url.Scheme))?page=' + $("#pib").val());
                        layer.msg('激活成功', { icon: 1 });
                    }
                }).fail(function (err) {
                    layer.msg('系统错误,请稍后重试', { icon: 2 });
                })
                layer.close(index)//关闭加载层
            }, function () {
                layer.close();
            });
        }
        function Delete(UserId) {
            layer.confirm('确定要删除该会员吗？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                //加载层
                var index = layer.load(1, {
                    shade: [0.1, '#fff']
                });
                $.ajax({
                    type: "post",
                    url: "/User/Activation/Delete",
                    data: { UserId: UserId },
                }).success(function (message) {
                    if (message != '成功') {
                        layer.msg(message, { icon: 2 });
                    }
                    else {
                        $("#dvCategoryResults").load('@(Url.Action("List", "Activation", null, Request.Url.Scheme))?page=' + $("#pib").val());
                        layer.msg('删除成功', { icon: 1 });
                    }
                }).fail(function (err) {
                    layer.msg('系统错误,请稍后重试', { icon: 2 });
                })
                layer.close(index)//关闭加载层
            }, function () {
                layer.close();
            });
        }
    </script>
